package com.net.xpay.core.dao.auto;

import com.net.xpay.core.domain.auto.AutoPayOrder;
import com.net.xpay.core.enums.AutoPayOrderStatus;
import com.net.xpay.core.model.AutoPayOrderSearchModel;
import com.net.common.dao.Page;
import com.net.common.dao.VersionedMapper;
import com.net.common.annotation.DataShard;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

@DataShard("xpay")
@Repository
public interface AutoPayOrderMapper extends VersionedMapper<Long, AutoPayOrder> {
    int batchSave(@Param("records") List<AutoPayOrder> records);

    int batchUpdate(@Param("records") List<AutoPayOrder> records);

    List<AutoPayOrder> search(@Param("searchModel") AutoPayOrderSearchModel searchModel, @Param("page") Page page);

    long searchCount(@Param("searchModel") AutoPayOrderSearchModel searchModel);

    int updateAutoPayOrderStatus(@Param("userId") Long userId, @Param("autoPayBatchId") Long autoPayBatchId , @Param("status") AutoPayOrderStatus status);

    BigDecimal sumEnsuredAmount(@Param("userId") Long userId);

    List<AutoPayOrder> list(@Param("searchModel") AutoPayOrderSearchModel searchModel);
}
